#ifndef SHOWWIDGET_H
#define SHOWWIDGET_H
#include <QTabWidget>
#include <QDebug>
#include <QHBoxLayout>
#include "common.h"
#include "format.h"
#include "showwidgets/screenwidget.h"

struct ScreenShowData
{
    Screen screen_data;
    ScreenWidget *screen_widget;
};

class MyTabWidget : public QTabWidget
{
    Q_OBJECT
public:
    explicit MyTabWidget(QWidget *parent = 0);
    void showFormatData(Format* format);
    void tabAddScreen(Screen add_screen);
    void tabUpdateScreens(Format* formatn);
    int getCurrentChangedScreenId(int index);
    void setCurrentChangeedScreenFromId(int screen_id);
    void setPartitionSelected(int screen_id, int partition_id);
    void setLayoutSelected(int screen_id, int partition_id, int layout_id);
    void setItemSelected(int screen_id, int partition_id, int layout_id, int item_id, QString cab_pos_item_str);
    void setAllChildrenLossSelect();

    int tabDelCurrentScreen();

    void delScreen(int screen_id);
    void delPartition(int screen_id, int partition_id);
    void addPartition(int screen_id, Partition add_partition);
    void addLayout(int screen_id, int partition_id, Layout add_layout);
    void delLayout(int screen_id, int partition_id, int layout_id);
    void addItem(int screen_id, int partition_id, int layout_id, Item add_item);
    void delItem(int screen_id, int partition_id, int layout_id, int item_id);
    void addCabPos(int screen_id, int partition_id, int layout_id, int item_id, QString cab_pos_item_str, CabPosItem add_cabpositem);
    void delCabPos(int screen_id, int partition_id, int layout_id, int item_id, QString cab_pos_item_str);

protected:
    void mousePressEvent(QMouseEvent *event);

private:
    QMap<int, ScreenShowData> m_screens_data;
    Format *m_format;
};

#endif // SHOWWIDGET_H
